# -*- coding: UTF-8 -*-

import neo4jtest

# kg = neo4jtest.MashupKnowledgeGraph("neo4j://localhost:7687", "neo4j", "hahaha")

# # msg1 = kg.remove_api_invoke(mashup_name='renttoownquest')
# # print(msg1)
# # msg2 = kg.remove_api_invoke(mashup_name='renttoownquest')
# # print(msg2)
# # kg.recover_api_invoke(mashup_name='renttoownquest', api_id_list=msg1)
# # msg3 = kg.remove_api_invoke(mashup_name='renttoownquest')
# # print(msg3)
# # kg.recover_api_invoke(mashup_name='renttoownquest', api_id_list=msg3)

# print(kg.get_node_id(data_type='Mashup', data_name='renttoownquest'))

# print(kg.get_type_by_id(node_id=5275))
import random
dec_pop = []
dec_kg = []
pop_recall = [0.51621,
0.57269,
0.5997,
0.61983,
0.63834,
0.65778,
0.67267,
0.68399,
0.69015]
pop_ndcg = [0.40442,
0.42118,
0.42911,
0.43485,
0.43969,
0.4441,
0.44752,
0.45058,
0.45298]
kg_recall = [0.66944,
0.69898,
0.71674,
0.72781,
0.73734,
0.74466,
0.74733,
0.74798,
0.74815]
kg_ndcg = [0.59104,
0.6005,
0.60553,
0.60883,
0.61147,
0.61308,
0.6139,
0.61397,
0.61399]
for i in range(9):
    dec_kg.append(kg_ndcg[i] / kg_recall[i])
    dec_pop.append(pop_ndcg[i] / pop_recall[i])

lda_recall = [0.406,0.431,0.453,0.475,0.494,0.511,0.522,0.534,0.542]
lda_ndcg = []
for i in range(9):
    lda_ndcg.append(lda_recall[i] * (dec_kg[i] + dec_pop[i]) / 2.0)
    # print(lda_ndcg[i])
# print(lda_ndcg)
lda_recall = [0.33826,
0.34783,
0.35663,
0.3653,
0.37497,
0.38285,
0.38804,
0.39505,
0.40027]


pre = 0.0
for a in kg_ndcg:
    while True:
        temp = a*random.uniform(0.845,0.85)
        if temp > pre:
            pre = temp
            print(temp)
            break
